/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ucb.sispro.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author felipe
 */
@Entity
@Table(name = "categoriadecardapio")
@NamedQueries({
    @NamedQuery(name = "CategoriaDeCardapio.findAll", query = "SELECT c FROM CategoriaDeCardapio c"),
    @NamedQuery(name = "CategoriaDeCardapio.findByIdCategoria", query = "SELECT c FROM CategoriaDeCardapio c WHERE c.idCategoria = :idCategoria"),
    @NamedQuery(name = "CategoriaDeCardapio.findByCategoria", query = "SELECT c FROM CategoriaDeCardapio c WHERE c.categoria = :categoria")})
public class CategoriaDeCardapio implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idCategoria")
    private Integer idCategoria;
    @Basic(optional = false)
    @Column(name = "categoria")
    private String categoria;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "categoriaDeCardapioidCategoria")
    private List<ItemCardapio> itemCardapioList;
    @JoinColumn(name = "Estabelecimento_idEstabelecimento", referencedColumnName = "idEstabelecimento")
    @ManyToOne(optional = false)
    private Estabelecimento estabelecimentoidEstabelecimento;

    public CategoriaDeCardapio() {
    }

    public CategoriaDeCardapio(Integer idCategoria) {
        this.idCategoria = idCategoria;
    }

    public CategoriaDeCardapio(Integer idCategoria, String categoria) {
        this.idCategoria = idCategoria;
        this.categoria = categoria;
    }

    public Integer getIdCategoria() {
        return idCategoria;
    }

    public void setIdCategoria(Integer idCategoria) {
        this.idCategoria = idCategoria;
    }

    public String getCategoria() {
        return categoria;
    }

    public void setCategoria(String categoria) {
        this.categoria = categoria;
    }

    public List<ItemCardapio> getItemCardapioList() {
        return itemCardapioList;
    }

    public void setItemCardapioList(List<ItemCardapio> itemCardapioList) {
        this.itemCardapioList = itemCardapioList;
    }

    public Estabelecimento getEstabelecimentoidEstabelecimento() {
        return estabelecimentoidEstabelecimento;
    }

    public void setEstabelecimentoidEstabelecimento(Estabelecimento estabelecimentoidEstabelecimento) {
        this.estabelecimentoidEstabelecimento = estabelecimentoidEstabelecimento;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCategoria != null ? idCategoria.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CategoriaDeCardapio)) {
            return false;
        }
        CategoriaDeCardapio other = (CategoriaDeCardapio) object;
        if ((this.idCategoria == null && other.idCategoria != null) || (this.idCategoria != null && !this.idCategoria.equals(other.idCategoria))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.ucb.sispro.model.CategoriaDeCardapio[ idCategoria=" + idCategoria + " ]";
    }
    
}
